package com.huipinche.service.impl;

import com.huipinche.dao.bean.User;
import com.huipinche.dao.impl.UserDaoimpl;
import com.huipinche.service.registerUserService;

/**
 * @Auther: 石硕栋
 * @Date:
 * @Description:
 */
public class registerUserServiceimpl implements registerUserService {
    @Override
    public boolean registerUser(String username, String password, String tel) {
        //判断username是否存在，如果存在返回false，如果不存在新建User对象返回true
        if(new UserDaoimpl().getUserByName(username) != null ){
            return false;
        }
        else {
            User user = new User();
            user.setUser(username);
            user.setPassword(password);
            user.setTel(tel);
            new UserDaoimpl().insertUser(user);
            return true;

        }

    }
}
